require.config({
    paths: {
        jquery: '../jquery-1.11.1.min',
        jquerymobile: '../jquery.mobile-1.4.5.min',
        jqmdatebox: '../jqm-datebox-bundle',
        presenter: 'app/presenter',
        view: 'app/view',
        model: 'app/model',
        backend: 'app/backend',
        utils: 'app/utils',
    }
});

require(['jquery','jquerymobile','jqmdatebox','view'], function($,jqm,jqmdatebox,View) {
    $(function() {
        $( "body>[data-role='panel']" ).panel();
    }
    );
    
    if (window.isCordovaApp) {
            var startup = function() {

                $(function() {
                    alert("started.");
                    var view = new View();
                    view.preInit();
                });
            };

            // Poll for Phonegap (Cordova) to avoid race conditions
            // with the deviceready event. For local development,
            // startup may need to be called directly.
            (function checkCordova() {
                // Check if Cordova exists
                if (window.cordova) {
                    // Listen for the deviceready event
                    document.addEventListener('deviceready', startup, false);
                } else {
                    // If Cordova does not exist, check again in 1/60th second
                    setTimeout(checkCordova, 16);
                }
            }());
    }    
});

